package text;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;

// 文本流(用于放置文本,也可以放置其他组件)
public class TextFlowDemo extends Application {
	private Pane root = new Pane();
	private TextFlow tf;
	
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) throws Exception {
		
		tf = new TextFlow();
		tf.setStyle("-fx-background-color: yellow; -fx-font-size: 20");
		
		Text text1 = new Text("hello1\n");
		Text text2 = new Text("hello2");
		Text text3 = new Text("hello3");
		tf.getChildren().addAll(text1, text2, text3);
		root.getChildren().addAll(tf);
	    
	    Scene scene = new Scene(root, 600, 400);    
	    stage.setScene(scene);
		stage.show();
	}
}
